{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[Sebastian Raschka](http://www.sebastianraschka.com)\n",
    "\n",
    "[back](https://github.com/rasbt/matplotlib-gallery) to the `matplotlib-gallery` at [https://github.com/rasbt/matplotlib-gallery](https://github.com/rasbt/matplotlib-gallery)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%load_ext watermark"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Last updated: 30/07/2014 \n",
      "\n",
      "CPython 3.4.1\n",
      "IPython 2.1.0\n",
      "\n",
      "matplotlib 1.3.1\n",
      "numpy 1.8.1\n",
      "scipy 0.14.0\n"
     ]
    }
   ],
   "source": [
    "%watermark -u -v -d -p matplotlib,numpy,scipy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Errorbar Plots in matplotlib"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Sections"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- [Standard Deviation, Standard Error, and Confidence Intervals](#Standard-Deviation,-Standard-Error,-and-Confidence-Intervals)\n",
    "- [Adding error bars to a barplot](#Adding-error-bars-to-a-barplot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<br>\n",
    "<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Standard Deviation, Standard Error, and Confidence Intervals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[[back to top](#Sections)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed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v309CQgKpqakcPXqUyZMns2/fvtD0\njIwM1qxZE/VXrUOGDOH3v/89a9as4cCBA4wdO5brr7+eOnWiH/blXAmL1FpxkezBJfy8vCksWZJN\nXt4UzxI9QFJSEsuXL+eiiy6icePGdO/enS5dujB9+nQALr/8cjp37kxGRgbp6ekA/OlPf+L++++n\nSZMmTJkyheuuu67EMstKthMnTqRt27a0b9+evn37cuONN4bm79SpE3fffTfdu3cnIyODlStXlqgi\nKX6aY7jHH3+cAwcOkJGRwciRIxk5cmS525ycnEzjxo3p0qULeXl5vPbaa4wYMQKAOnXqkJOTwz/+\n8Q86dOhAWloaN998c4lEfdVVV7F69WpatmzJueeeGzG+vn370rdvX84++2zatWtHw4YNS1QxXXvt\ntQA0b96crl27nhDjyJEjGTZsGD179qRDhw40atSoxIkx0j6O9YQrUtvU1CM74r0GPZtEqpOOP6np\n9GwcEZE4p2QvIhIHlOxFROKAkr2ISBxIqO4ARCTOLFniXsXDfr8b9vuPD4vn1BpHJEY6/qqAzxf7\nz9SlXGqNIyIS55TsRUTigJL9aeB06pZQRKqGkr1H4rVbwuLX/Pnzqzs0ESlD3LTGyX07l5lzZ3LE\njpDoS2T00NH0793fk2UXd0v41FNPMXjwYI4cOcJ7771Xa7olrFu37kl/bu/evWU+UKxYUVFRifkK\nCgpISIj9sDvZ+UUksrgo2ee+ncuYP45hcbvFLG2/lMXtFjPmj2PIfTvXk+V/9913+Hw+rrvuOnw+\nHw0aNKB3796ce+65fPPNN9x666189NFHJCUl0axZMxdTbi7nn38+TZs2JTMzk0mTJoWWV1x6fuGF\nF2jbti1paWlMnTo1ND0/P58RI0bQrFkzOnfuzKeffloinv/8z//krLPOokmTJnTu3Jk33ngjNO35\n55/nl7/8JXfddRepqalMmjSJXbt2cdVVV9G0aVMuuugivv/++wrvixEjRnDrrbfSr18/GjduzLvv\nvku7du2YNm0aXbp0ISkpicLCQt588006d+5MSkoKl156KatWrQoto/T8sT76WURqn2i9sFSo95Y+\nI/oY2ZzwCtwUq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SoZC8SD1Sy91RZJXv9glZEJA4o2YuIxAElexGROKBkLyISB5TsRUTigJK9iEgcULIX\nEYkDSvYiInFAyV5EJA4o2YuIxAElexGROKBkLyISB5TsRUTigJK9iEgcULIXEYkDSvYiInFAyV5E\nJA4o2YuIxAElexGROKA+aEXk1FqyxL2Kh/1+N+z3Hx+WCimrD1olexGR04Q6HBcRiXNK9iIicUDJ\nXkQkDijZi4jEASV7EZE4oGQvIhIHlOxFROKAkr2ISBxQshcRiQNK9iIicUDJXkQkDijZi4jEASV7\nEZE4oGQvIhIHlOxFROKAkr2ISBxQshcRiQNK9iIicUDJXkQkDijZi4jEASV7EZE4oGQvIhIHlOxF\nROKAkr2ISBxQshcRiQO+6g4giiVAr+oOQkSklpkEZFd3ECIiIiIiIiIiIiIiIiIiIiIip7f/DwfT\nEN90La91AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10635a2e8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "from scipy.stats import t\n",
    "\n",
    "# Generating 15 random data points in the range 5-15 (inclusive)\n",
    "X = np.random.randint(5, 15, 15)\n",
    "\n",
    "# sample size\n",
    "n = X.size\n",
    "\n",
    "# mean\n",
    "X_mean = np.mean(X)\n",
    "\n",
    "# standard deviation\n",
    "X_std = np.std(X)\n",
    "\n",
    "# standard error\n",
    "X_se = X_std / np.sqrt(n)\n",
    "# alternatively:\n",
    "#    from scipy import stats\n",
    "#    stats.sem(X)\n",
    "\n",
    "# 95% Confidence Interval\n",
    "\n",
    "dof = n - 1         # degrees of freedom\n",
    "alpha = 1.0 - 0.95\n",
    "conf_interval = t.ppf(1-alpha/2., dof) * X_std*np.sqrt(1.+1./n)\n",
    "\n",
    "fig = plt.gca()\n",
    "plt.errorbar(1, X_mean, yerr=X_std, fmt='-o')\n",
    "plt.errorbar(2, X_mean, yerr=X_se, fmt='-o')\n",
    "plt.errorbar(3, X_mean, yerr=conf_interval, fmt='-o')\n",
    "\n",
    "plt.xlim([0,4])\n",
    "plt.ylim(X_mean-conf_interval-2, X_mean+conf_interval+2)\n",
    "\n",
    "# axis formatting\n",
    "fig.axes.get_xaxis().set_visible(False)\n",
    "fig.spines[\"top\"].set_visible(False)  \n",
    "fig.spines[\"right\"].set_visible(False)  \n",
    "plt.tick_params(axis=\"both\", which=\"both\", bottom=\"off\", top=\"off\",  \n",
    "                labelbottom=\"on\", left=\"on\", right=\"off\", labelleft=\"on\")  \n",
    "\n",
    "plt.legend(['Standard Deviation', 'Standard Error', 'Confidence Interval'], \n",
    "           loc='upper left',\n",
    "           numpoints=1,\n",
    "           fancybox=True)\n",
    "\n",
    "plt.ylabel('random variable')\n",
    "plt.title('15 random values in the range 5-15')\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<br>\n",
    "<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Adding error bars to a barplot"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[[back to top](#Sections)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEBCAYAAAB/rs7oAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE1ZJREFUeJzt3X+UHWV9x/H3JkCJRH6JJJCELBSwxlrAekJEhYvaFrAN\nR4sHUNsGrUQ0ipSeAhabS6U1VttDQcXYqkS04A9axDYolsMGqDVaIcEKaKIsJOEsURMCJLEG2f7x\nnZudvbl3d3azz95snvfrnDl3fjx35pvdzWfmPjN3BiRJkiRJkiRJkiRJkiRJkiSpkhuAD47zNq8A\n/mmI5QuAe8anlDHTC7y200WocyZ1ugBNKL3ANuBpYBPw78DMcdx+fzFU8RxwzBhs80PAO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dg4ODgUH2oM872AX4MdAP7\nEeHd6uTu8mJ8HvDt8SpOkpTGmcAPiZO8VxTzFhZDw8eK5auBl41rdZIkSZIkSZIkSZIkSZIkSZIk\nSZIkSdJY+X+HxbZE4o1zggAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1066ce0f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# input data\n",
    "mean_values = [1, 2, 3]\n",
    "variance = [0.2, 0.4, 0.5]\n",
    "bar_labels = ['bar 1', 'bar 2', 'bar 3']\n",
    "\n",
    "fig = plt.gca()\n",
    "\n",
    "# plot bars\n",
    "x_pos = list(range(len(bar_labels)))\n",
    "plt.bar(x_pos, mean_values, yerr=variance, align='center', alpha=0.5)\n",
    "\n",
    "# set height of the y-axis\n",
    "max_y = max(zip(mean_values, variance)) # returns a tuple, here: (3, 5)\n",
    "plt.ylim([0, (max_y[0] + max_y[1]) * 1.1])\n",
    "\n",
    "# set axes labels and title\n",
    "plt.ylabel('variable y')\n",
    "plt.xticks(x_pos, bar_labels)\n",
    "plt.title('Bar plot with error bars')\n",
    "\n",
    "# axis formatting\n",
    "fig.axes.get_xaxis().set_visible(False)\n",
    "fig.spines[\"top\"].set_visible(False)  \n",
    "fig.spines[\"right\"].set_visible(False)  \n",
    "plt.tick_params(axis=\"both\", which=\"both\", bottom=\"off\", top=\"off\",  \n",
    "                labelbottom=\"on\", left=\"on\", right=\"off\", labelleft=\"on\")  \n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
